/**
 * @Author 天下无敌
 * @Date 
 * @AIDE AIDE+ 
 */
package com.ecs.core.gsystem;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.artemis.BaseSystem;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.Batch;

public class RenderContextSystem extends BaseSystem{

	private final SpriteBatch batch;
	private final ShapeRenderer shapeRenderer;

	private final OrthographicCamera camera;

	public RenderContextSystem(OrthographicCamera camera)
	{
		super();
		this.camera = camera;
		this.batch = new SpriteBatch();
		this.shapeRenderer = new ShapeRenderer();
	}

	public void batchBegin() {
		batch.setProjectionMatrix(camera.combined);
		batch.begin();
	}
	public void batchEnd() {
		batch.end();
	}
	public void shapeBegin(ShapeRenderer.ShapeType type) {
		shapeRenderer.setProjectionMatrix(camera.combined);
		shapeRenderer.begin(type);
	}

	public void shapeEnd() {
		shapeRenderer.end();
	}

	public Batch getBatch() {
		return batch;
	}

	public ShapeRenderer getShapeRenderer() {
		return shapeRenderer;
	}

	@Override
	public void dispose()
	{
		batch.dispose();
		shapeRenderer.dispose();
	}

	@Override
	protected void processSystem()
	{
	}

}

